// 导入自己封装的axios实例对象
import request from '@/utils/request'
// 导入仓库实例
// import store from '@/store'

// 登录请求
export const Login = data=>{
  return request({
    url:'/v1_0/authorizations',
    method:'post',
    data
  })
}

// 获取验证码
export const getSms = data=>{
  return request({
    url:'/v1_0/sms/codes/'+data,
    method:'GET'
  })
}

// 获取用户资料
export const getUserInfo = ()=>{
  return request({
    url:'/v1_0/user',
    // headers:{
    //   Authorization:'Bearer '+store.getters.token
    // }
  })
}

// 关注用户
export const addFollow = data=>{
  return request({
    url:'/v1_0/user/followings',
    method:'post',
    data
  })
}

// 取消关注用户
export const deleteFollow = target=>{
  return request({
    url:'/v1_0/user/followings/'+target,
    method:'delete',
  })
}

// 获取用户详细资料
export const getUserProfile = ()=>{
  return request({
    url:'/v1_0/user/profile'
  })
}

// 编辑用户详细资料
export const editUserProfile = data =>{
  return request({
    url:'/v1_0/user/profile',
    method:'PATCH',
    data
  })
}

// 编辑用户头像
export const updateUserPhoto = data=>{
  return request({
    url:'/v1_0/user/photo',
    method:'PATCH',
    data
  })
}
